package com.cskaoyan.javase.object.equals4;

/**
 * @description: 计算小数
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

import java.math.BigDecimal;

/**
 * BigDecimal计算小数
 * subtract(BigDecimal subtrahend)
 *
 */
public class Demo2 {
    public static void main(String[] args) {
        //double b1 = 0.1;
        double b2 = 1-0.9;
        System.out.println(b2);
        BigDecimal bigDecimal = new BigDecimal("1");
        BigDecimal bigDecimal2 = new BigDecimal("0.9");
        BigDecimal subtract = bigDecimal.subtract(bigDecimal2);//得到结果
        System.out.println(subtract);

    }
}
